#include"five-in-a-row.h"
#include<iostream>

int main()
{
    Board a;
    Player x;
    
    char player = 'X';
    int row = 0, column = 0;
    while (1)
    {
        a.PrintRow();
        std::cout << "请" << player << "选手下棋：";
        if (player == 'X')
        {
            scanf("%d %d", &row, &column);
            if (x.MakeMove(a, row - 1, column - 1, player) == false)
            {
                continue;
            }
        }
        else
        {
            std::cout<<"ai正在下棋\n";
            if (x.AIMakeMove(a, 'X', 'O', row - 1, column - 1) == false)
            {
                continue;
            }
        }
        if (x.CheckIsWin(a, row - 1, column - 1, player) == true)
        {
            a.PrintRow();
            std::cout << "恭喜" << player << "选手获胜\n";
            break;
        }
        if (x.CheckIsDraw(a, player) == true)
        {
            a.PrintRow();
            std::cout<<"平局\n";
            break;
        }
        player = (player == 'X' ? 'O' : 'X');
    }
    return 0;
    return 0;
}